<?php
//print_r(get_option('widget_nmedia_mail_chimp'));
if ( count($_POST) > 0 && isset($_POST['btn_options']) )
{
		$msg = seoAddCategroy(trim($_POST['kw_category']));
}


if ( isset($_GET['cat']) )
{
		$msg = seoDelCategroy($_GET['cat']);
}

$arrCategories = seoGetCategories();
//$data = get_option('widget_nmedia_mail_chimp');
/*print_r($arrCategories);*/


echo $msg;
?>

<script type="text/jscript">
function confirmDel(url)
{
	var a = confirm('Are you to delete this categor?');
	if(a)
	{
		window.location = url
	}
}
</script>

<h1>Rank Categories</h1>
<form action="<?php echo str_replace( '%7E', '~', $_SERVER['REQUEST_URI'])?>" method="post">
<table width="800" class="xet_settings_tbl">
  <tr>
    <td valign="middle">Category Name</td>
    <td valign="top"><input type="text" name="kw_category" id="kw_category" size="63" value="<?php echo $kw_category?>" /></td>
  </tr>
  <tr>
    <td valign="top">&nbsp;</td>
    <td valign="top"><input type="submit" value="Save Category" name="btn_options" /></td>
  </tr>
  <tr>
    <td valign="top">&nbsp;</td>
    <td valign="top">&nbsp;</td>
  </tr>
</table>
</form>
<br /><br />

<h2>Categories List</h2>
<table width="500" border="0">
  <tr>
    <td>Sr #</td>
    <td>Category</td>
    <td colspan="2">Action</td>
  </tr>
  
  <?php foreach($arrCategories as $cat):
  $urlDeleteCategory = $_SERVER['REQUEST_URI'] . '&cat='.$cat['category'];
  ?>
  <tr>
    <td>1</td>
    <td><?= $cat['category']?></td>
    <td><a href="javascript:confirmDel('<?= $urlDeleteCategory?>')">Delete</a></td>
  </tr>
  <?php endforeach;?>
</table>
<br />
<br />



<a href="http://www.najeebmedia.com/"><img src="http://www.najeebmedia.com/logo.png" alt="Nmedia Logo" border="0" width="175" /></a>
<p>
Nmedia providing Web Application Development and Designing services with a team of Skilled and Professional Buddies. We have developed many E-commerce, Wordpress, Bespoke web projects at very reasonable prices. Must see our projects and feedbacks from our respected clients by visiting company site: <a href="http://www.najeebmedia.com/">Nmedia</a><br />
<br />
Thanks<br />
Najeeb Ahmad<br />
<a href="mailto:ceo@najeebmedia.com">ceo@najeebmedia.com</a>
</p>